package com.wen.open.springframework.test.context;

import com.wen.open.springframework.beans.BeansException;
import com.wen.open.springframework.beans.PropertyValue;
import com.wen.open.springframework.beans.factory.ConfigurableListableBeanFactory;
import com.wen.open.springframework.beans.factory.config.BeanDefinition;
import com.wen.open.springframework.beans.factory.config.BeanFactoryPostProcessor;

/**
 * @author Wen
 * @date 2023/4/24 17:25
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition userService = beanFactory.getBeanDefinition("userService");
        userService.getPropertyValues().addPropertyValue(new PropertyValue("age", 18));
    }
}
